package com.rainszj.service.impl;

import com.rainszj.mapper.UserMapper;
import com.rainszj.pojo.po.User;
import com.rainszj.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author rainszj
 * 2020/3/10
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    // DigestUtils;

    @Override
    public User checkUser(String username, String password) {
        User user = userMapper.queryByUsernameAndPassword(username, password);

        if (user == null) {
            return null;
        }
        return user;
    }

    /**
     * 通过用户名查询用户
     * @return
     */
    @Override
    public User queryUserByName(String username) {
        User user = userMapper.queryUserByName(username);

        return user;
    }
}
